package com.steakliu.shardingsphere.jdbc.loadbalance;

import lombok.Getter;
import org.apache.shardingsphere.readwritesplitting.spi.ReadQueryLoadBalanceAlgorithm;

import java.util.List;
import java.util.Properties;

/**
 * 功能说明： hash算法
 * <p>
 * Original @Author: steakliu-刘牌, 2022-07-20  18:05
 * <p>
 * Copyright (C)2020-2022  steakliu All rights reserved.
 */
public class CustomReplicaLoadBalanceAlgorithm implements ReadQueryLoadBalanceAlgorithm {

    @Getter
    private Properties props;

    @Override
    public String getDataSource(final String name, final String writeDataSourceName, final List<String> readDataSourceNames) {
        return "db2";
    }

    @Override
    public String getType() {
        return "CUSTOM";
    }

    @Override
    public void init(Properties props) {
        this.props = props;
    }

    @Override
    public boolean isDefault() {
        return false;
    }
}
